# Maintainer: Laurent Carlier <lordheavym@gmail.com>

pkgname=spirv-tools
pkgver=2018.5
pkgrel=1
pkgdesc="API and commands for processing SPIR-V modules"
arch=('x86_64')
url="https://www.khronos.org/vulkan/"
license=('custom')
groups=(vulkan-devel)
depends=(gcc-libs)
makedepends=(cmake python git)
source=("git+https://github.com/KhronosGroup/SPIRV-Tools.git#tag=v${pkgver}"
        git+git://github.com/KhronosGroup/SPIRV-Headers.git)
sha256sums=('SKIP'
            'SKIP')

build() {
  cd SPIRV-Tools

  rm -rf build && mkdir build && cd build
  cmake .. \
      -DCMAKE_INSTALL_PREFIX=/usr \
      -DCMAKE_INSTALL_LIBDIR=lib \
      -DCMAKE_BUILD_TYPE=Release \
      -DSPIRV_WERROR=Off \
      -DSPIRV-Headers_SOURCE_DIR=${srcdir}/SPIRV-Headers
  make
}

package() {
  cd SPIRV-Tools/build

  make DESTDIR="${pkgdir}" install

  install -dm755 "${pkgdir}/usr/share/licenses/${pkgname}"
  install -m644 ../LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/"
}
